package org.karelun.gef.figure;

import org.eclipse.draw2d.BorderLayout;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Color;

public class StateStartFigure extends NodeFigure {

    private class StartShape extends Shape{		
		protected void fillShape(Graphics graphics) {
			Rectangle r = this.getBounds();
			Rectangle r1=new Rectangle(r.x, r.y, r.width-1 ,r.height-1);
			graphics.fillOval(r1);
		}
		
		protected void outlineShape(Graphics graphics) {
		}
	}
	
    private StartShape shape=null;
	
	public StateStartFigure() {
		super();
		label=new Label();
	    BorderLayout layout = new BorderLayout();
		setLayoutManager(layout);
		
		shape= new StartShape();
		shape.add(label);
		setOpaque(true);
		add(shape,BorderLayout.CENTER);
		
		
	}

    public void setBounds(Rectangle rect) {
        super.setBounds(rect);
        this.label.setBounds(rect);
    }

	@Override
	protected void setBGColor(Color color) {
		if(shape==null)
			return;
		shape.setBackgroundColor(color);
		
	}
}